a build.gradle file for java

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'

mainClassName = 'hello.HelloWorld'

// tag::repositories[]
repositories {
    mavenLocal()
    mavenCentral()
}
// end::repositories[]

// tag::jar[]
jar {
    baseName = 'test'
    version =  '1.0'
        manifest {
        attributes 'Main-Class': 'hello.HelloWorld'
    }
}
// end::jar[]

// tag::dependencies[]
sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile "joda-time:joda-time:2.2"
}
// end::dependencies[]

// tag::wrapper[]
// end::wrapper[]

references:

https://stackoverflow.com/questions/61234260/no-main-manifest-attribute-in-jar-file